<?php if (isset($cats) && !empty($cats)): ?>
    <div class="global-tabs">
        <div class="owl-carousel global-tabs__title">
            <?php foreach ($cats as $cat): ?>
                <div class="item">
                    <a href="#"><?php echo $cat['pageTitle']; ?></a>
                </div>
            <?php endforeach; ?>
        </div>
        <div class="customNavigation">
            <span class="btn prev">Previous</span>
            <span class="btn next">Next</span>
        </div>
        <div class="owl-carousel global-tabs__content">
            <?php foreach ($cats as $brand): ?>
                <div class="item">
                    <h3 class="middle-title">Чаще всего к нам обращаются владельцы</h3>
                    <div class="model-list">
                        <ul>
                            <?php $models = Page::model()->findAll("\"pageParent\" = '{$brands[$brand['pageId']]['pageId']}'  ORDER BY \"pageSort\" LIMIT 4"); ?>
                            <?php
                            $c = new CDbCriteria();
                            $c->select = '"pageTitle", "pageUrl"';

                            foreach ($models as $model):
                                $c->compare('"pageId"', $model['pageParent']);
                                $br = Page::model()->find($c);
                                ?>

                                <li>
                                    <div class="model-list__item">
                                        <div class="model-list__photo">
                                            <a href="/<?php echo $model['pageUrl']; ?>">
                                                <?php $src = $this->getController()->getImageUrl('/image/resize/200x200/uploads/images/model/' . $model['pageImages']); ?>
                                                <img src="<?php echo $src; ?>" alt="<?php echo $model['pageTitle']; ?>" />

                                            </a>
                                        </div>
                                        <h3>
                                            <a href="/<?php echo $model['pageUrl']; ?>"><?php
                                                $b = isset($br['pageTitle']) ? $br['pageTitle'] : '';
                                                echo $b . ' ' . $model['pageTitle'];
                                                ?></a>
                                        </h3>
                                    </div>    
                                </li>
                            <?php endforeach; ?>
                        </ul>
                    </div>
                    <div class="global-tabs__bottom-panel">
                        <span class="global-button green-bg">
                            <a href="/<?php echo $brands[$brand['pageId']]['pageUrl']; ?>">Другие модели</a>
                        </span>
                    </div>    
                </div>
            <?php endforeach; ?>
        </div>        
    </div>
<?php endif; ?>